import Vue from "vue";
import VueRouter from "vue-router";

//登录
import login from "@/views/login";
//首页
import index from "@/views/index";
//注册
import register from "@/views/register";


/**
 *内部页面
 */
// 货主管理
import home from "@/views/manage/home";                     //首页
import certified from "@/views/manage/certified";           //认证
import review from "@/views/manage/review";                 //审核
import order from "@/views/manage/order";                   //订单管理
import waybill from "@/views/manage/waybill";               //运单管理
import orderledger from "@/views/manage/orderledger";       //订单台账
import waybillledger from "@/views/manage/waybillledger";   //运单台账
import oftenrace from "@/views/manage/oftenrace";           //常跑路线 地址
import sendaddress from "@/views/manage/sendaddress";       //发货地址
import acceptaddress from "@/views/manage/acceptaddress";   //收货地址
import driverlist from "@/views/manage/driverlist";         //司机管理
import carlist from "@/views/manage/carlist";               //车辆管理
import carwrite from "@/views/manage/carwrite";             //车俩填写审核
import driverwrite from "@/views/manage/driverwrite";             //司机填写审核




Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    redirect: {
        name: 'login'
    }
 },
  {
    path: "/login",
    name: "login",
    component: login,
    meta: {
      requireAuth: false
    }
  },
  {
    path: "/register",
    name: "register",
    component: register,
    meta: {
      requireAuth: false
    }
  },
  {
    path: "/index",
    name: "index",
    component: index,
    children: [
      // common 公用
      {
        path: "/home",
        name: "home",
        component: home,
        meta: {
          requireAuth: true
        }
      },{
        path: "/certified",
        name: "certified",
        component: certified,
        meta: {
          requireAuth: true
        }
      },{
        path: "/certified/review",
        name: "review",
        component: review,
        meta: {
          requireAuth: true
        }
      },{
        path: "/order",
        name: "order",
        component: order,
        meta: {
          requireAuth: true
        }
      },{
        path: "/waybill",
        name: "waybill",
        component: waybill,
        meta: {
          requireAuth: true
        }
      },{
        path: "/orderledger",
        name: "orderledger",
        component: orderledger,
        meta: {
          requireAuth: true
        }
      },{
        path: "/waybillledger",
        name: "waybillledger",
        component: waybillledger,
        meta: {
          requireAuth: true
        }
      },{
        path: "/oftenrace",
        name: "oftenrace",
        component: oftenrace,
        meta: {
          requireAuth: true
        }
      },{
        path: "/sendaddress",
        name: "sendaddress",
        component: sendaddress,
        meta: {
          requireAuth: true
        }
      },{
        path: "/acceptaddress",
        name: "acceptaddress",
        component: acceptaddress,
        meta: {
          requireAuth: true
        }
      },{
        path: "/carlist",
        name: "carlist",
        component: carlist,
        meta: {
          requireAuth: true
        }
      },{
        path: "/driverlist",
        name: "driverlist",
        component: driverlist,
        meta: {
          requireAuth: true
        }
      },{
        path: "/carwrite",
        name: "carwrite",
        component: carwrite,
        meta: {
          requireAuth: true
        }
      },{
        path: "/driverwrite",
        name: "driverwrite",
        component: driverwrite,
        meta: {
          requireAuth: true
        }
      }
    ]
  }
];

const router = new VueRouter({
  routes
});

export default router;
